<template>
  <div>
    <preHeader></preHeader>
    <div class="top-block"></div>

  <div id="snotice">
    <noNotice v-if='noticeInfo == null '></noNotice>
    <div class="item" v-for="(item,index) in noticeInfo" :key='index'>
      <p class="title">{{item.title}}</p>
      <p class="txt" v-html="item.content"></p>
      <span class="date">{{new Date(parseInt(item.add_time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ')}}</span>
    </div>
  </div>
  </div>
</template>

<script>
  import noNotice from '@/components/noNotice/noNotice';
  import {get_notice} from '@/api/';
  export default {
    components: {
      noNotice
    },
    data(){
      return{
        noticeInfo:null,//通知列表
      }
    },
    methods:{
      getNotice(){
        get_notice().then(res =>{
          console.log(res)
          this.noticeInfo = res.data;
        })
      }
    },
    mounted(){
      this.getNotice();
    }
  }
</script>

<style scoped>
.item{margin: 10px;border: 1px solid #ddd;padding: 10px;overflow: hidden;border-radius: 6px;}
.item .title{margin-bottom: 10px;font-size: 16px;}
.txt{font-size: 14px;}
.date{float: right;margin-top: 10px;font-size: 14px;}
</style>
